UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lMwi6pcpNF+8q0SlEfdz5LpWCb8ldj9wzqvvvEBqK8o='
WHERE
key_id = 'f65296c9537cce209581d534a1736be70ad69c89a6544b4bfd6a95d8459f3ddb'
AND (
token = 'lMwi6pcpNF+8q0SlEfdz5LpWCb8ldj9wzqvvvEBqK8o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)