UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kcrEAsshGX2i+y0halHJkedBa5PNAqjFNbm4tHDFUBA='
WHERE
key_id = '0578224ddfe7b079d50ee1aa01d0f43e70d7e0204755fc012f00f76c1b13037e'
AND (
token = 'kcrEAsshGX2i+y0halHJkedBa5PNAqjFNbm4tHDFUBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)