UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dwQxEV+6u5UH7CT+xliYuoC5vGr12FP41e9SgaiihNk=' 
WHERE 
  key_id = '2e74ddbc02989daede69cf973e23e52b99ebd4d65eb1fb00d9cee4903efd08e8' 
  AND (
    token = 'dwQxEV+6u5UH7CT+xliYuoC5vGr12FP41e9SgaiihNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031