UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fcH+urUj1c4nSZKHilYmFsSeDHpNW3PMv9NJad5MU5w='
WHERE
key_id = 'ab766de5f2dc98a3ea3820bff1f1b886edca41c45efdafc374876890f330fdcb'
AND (
token = 'fcH+urUj1c4nSZKHilYmFsSeDHpNW3PMv9NJad5MU5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)