UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7bFbR2fLFMTDCRccm9i10Qe3bzN+szCd8s22NUAV94='
WHERE
key_id = '91121f27f82bf2e40f68e2378e6c16a7ac54c1c49e6183d792bf73df440a033a'
AND (
token = 'a7bFbR2fLFMTDCRccm9i10Qe3bzN+szCd8s22NUAV94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)