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