UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KfPVoLjghKLt7wPNhnC97B8X/KV7179U6PJePm6IfYc=' 
WHERE 
  key_id = 'b32eb0cec1fccd15698a9a80cf3801283fd051b477b421a8f467ebdc05ddd551' 
  AND (
    token = 'KfPVoLjghKLt7wPNhnC97B8X/KV7179U6PJePm6IfYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052