UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qFkKfbdXXJAWwinTwnjILH0KXQv/sGlgdV1Xmv2oM+o='
WHERE
key_id = 'c5a635eacb12c925d737a1914db25b9c730828d6b3555377141700d8f4f192c1'
AND (
token = 'qFkKfbdXXJAWwinTwnjILH0KXQv/sGlgdV1Xmv2oM+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)