UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5Q+xMIUT+SRLqqTBQhSC8F6ym1SQwVm3pMLbMjuZvo=' 
WHERE 
  key_id = 'ce46e7ea10a1e960912c2c9d5565b710c2cdafba6426635ee540fe3f4f88a710' 
  AND (
    token = 'X5Q+xMIUT+SRLqqTBQhSC8F6ym1SQwVm3pMLbMjuZvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017