UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qu2VMcg9ztlYwISNa7/556nAAoXSPiQ5uD2yVTzOFFY=' 
WHERE 
  key_id = '11ca31e1945ea71f78593ca7c92bba500c26c27cee464b8177d920083c2fa542' 
  AND (
    token = 'qu2VMcg9ztlYwISNa7/556nAAoXSPiQ5uD2yVTzOFFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032