UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T27EjTVY+8CXJ6Tg6wdWotoGjREz3MpxrgaOMZVv7cI='
WHERE
key_id = 'd8ad03d5981d34a272a60085fedc1f131755279cd64ed4ae8f7a136821ec5b9e'
AND (
token = 'T27EjTVY+8CXJ6Tg6wdWotoGjREz3MpxrgaOMZVv7cI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)