UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n5d0K/nc5M8fDThrD7Njm4faZrhjpcccnRcywDECTkI='
WHERE
key_id = '50e1b2d9d78b71fd92347ff7ce04a89c3d27e70e6e102b154dfc0ea507e21554'
AND (
token = 'n5d0K/nc5M8fDThrD7Njm4faZrhjpcccnRcywDECTkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)