UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jeJTaIEDmytd7lUzKyh2EfdZvHtErfFyOCgYlaXEA0k='
WHERE
key_id = 'c859de11c4c0d58974a85d2c11328dee9d7064752ef419a3bffaeea8380bf75a'
AND (
token = 'jeJTaIEDmytd7lUzKyh2EfdZvHtErfFyOCgYlaXEA0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)