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

Query time 0.00052