UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TIJmqn1JeqM0hosMYKb4L61Nk3/F0FNh7gMPADUVcP0='
WHERE
key_id = 'ebdc30221485966f8af1575a9483132cebd6ece430669e00fb4b31b47b08c87b'
AND (
token = 'TIJmqn1JeqM0hosMYKb4L61Nk3/F0FNh7gMPADUVcP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)