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