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