UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AK1b5KVuBF5hygNJyIAyiZaJFV2XaWXm/1mSq+i12Ms='
WHERE
key_id = 'e9fef72d013b3237e396c7f4293afb7ae4231d44179274fa022e1e0788451040'
AND (
token = 'AK1b5KVuBF5hygNJyIAyiZaJFV2XaWXm/1mSq+i12Ms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)