UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yto+lRtMhzdtgPb9PLJa+teY7qIzfsT4dhObv9qHMiY='
WHERE
key_id = 'cd0cf8a95d47820783017f208a96e39495a42752831a3e39ed7f15f290d1f7d8'
AND (
token = 'yto+lRtMhzdtgPb9PLJa+teY7qIzfsT4dhObv9qHMiY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)