UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2/ddstUKSLGb3r2Ml3SsNePyxicbNPAYk+xbrUV0//A=' 
WHERE 
  key_id = 'd3fa52a8a325bccb1c3674becf68862bf95c2fd31634ba8cd49f5bf455588034' 
  AND (
    token = '2/ddstUKSLGb3r2Ml3SsNePyxicbNPAYk+xbrUV0//A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037