UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GfrfP7nwoLfX7s38EqP+MmeOlBdrbBAe82NirN0wx5o='
WHERE
key_id = 'b483a960c1ae27e39ee5e7eb85c35b6c745b8bb5c1c175cd21692bcf61db4b18'
AND (
token = 'GfrfP7nwoLfX7s38EqP+MmeOlBdrbBAe82NirN0wx5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)