UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YO2Z5dTluABVeKrXwHOwYm4h4jK4WwVdY1rD+AL+o0s='
WHERE
key_id = '5a2d407d066a2f6852e0e8e821b73cee886c60af4cd10d476580cf40c3184860'
AND (
token = 'YO2Z5dTluABVeKrXwHOwYm4h4jK4WwVdY1rD+AL+o0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)