UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F11Ak4pKAHrjRsvU/wX043NWhBS5YxNgScZPKeAey/o=' 
WHERE 
  key_id = '0b5b2d7c5236c1a10f142f25e4e2506b5ea701a8eb81a51e1761a4e51a976867' 
  AND (
    token = 'F11Ak4pKAHrjRsvU/wX043NWhBS5YxNgScZPKeAey/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043