UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lrKMkMT6F/yIAoaRzPG4+DXY9CPa7sa40sYxB0g89QI='
WHERE
key_id = 'c2f5c7106412439ba839f70969e0d0618fae9f4a76f7b477269f64fbf5d1f8ee'
AND (
token = 'lrKMkMT6F/yIAoaRzPG4+DXY9CPa7sa40sYxB0g89QI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)