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