UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CXmzBR/IxUQRsP2ctrGDvjoldSbvHHJeLZncALoEWJ0='
WHERE
key_id = 'dc509cb8a164431922e7e744ca153d52feaffe2752e1acd7250b645b75fb58ab'
AND (
token = 'CXmzBR/IxUQRsP2ctrGDvjoldSbvHHJeLZncALoEWJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)