UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M2ap1E3hKLP6EVKPZECigE2weXZQaqp5GM66nvEokRA=' 
WHERE 
  key_id = '51f482c968130323c738f7f0c6c9fecf322d0710d59bc3c14d3d44b4b0c5b893' 
  AND (
    token = 'M2ap1E3hKLP6EVKPZECigE2weXZQaqp5GM66nvEokRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047