UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yswSQguptBfuC/aSCFxC1aKZzppB8lapefEYAMxAYyw=' 
WHERE 
  key_id = 'c7be1ce22984dba11699b4b4efb4398253095597b2b0663c22d9ffad1a524dde' 
  AND (
    token = 'yswSQguptBfuC/aSCFxC1aKZzppB8lapefEYAMxAYyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037