UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Dr0sb57Q6GUTaKU3JaXTuIc1M31FI6OWn5vTPR9exA='
WHERE
key_id = '30dd6b499f487ab1e99a734ff7545b43f29997228c0bfb27e234bab02072a60d'
AND (
token = '5Dr0sb57Q6GUTaKU3JaXTuIc1M31FI6OWn5vTPR9exA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)