UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJPQ3Xf82oyYuGRCDOkntY1SUMEO38PoF2ywhQB3OvE=' 
WHERE 
  key_id = '399f61a2c90df64a0f8983eb656962732084fe943cac135098f14ccdc889400c' 
  AND (
    token = 'AJPQ3Xf82oyYuGRCDOkntY1SUMEO38PoF2ywhQB3OvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037